import Vue from 'vue'
import VueRouter from 'vue-router'

const DiscoverMusic = () => import('views/discover/DiscoverMusic')
const Individuation = () => import('views/discover/childRouter/Individuation')
const MusicListCategory = () => import('views/discover/childRouter/MusicListCategory')
const MusicRankList = () => import('views/discover/childRouter/MusicRankList')
const ArtistCategory = () => import('views/discover/childRouter/ArtistCategory')
const NewSongsR = () => import('views/discover/childRouter/NewSongsR')
const MV = () => import('views/mv/MV')

// 详情页
const MusicListDetail = () => import('views/musicListDetail/MusicListDetail')
const DayMusicListDetail = () => import('views/musicListDetail/DayMusicListDetail')

// 歌手
const ArtistDetail = () => import('views/artistdetail/ArtistDetail')
const ArtistAlbum = () => import('views/artistdetail/childRouter/ArtistAlbum')
const ArtistMV = () => import('views/artistdetail/childRouter/ArtistMV')
const ArtistDescDetail = () => import('views/artistdetail/childRouter/ArtistDescDetail')
const SimiArtist = () => import('views/artistdetail/childRouter/SimiArtist')

// 搜索
const SearchList = () => import('views/search/SearchList')
const SearchSongs = () => import('views/search/childComps/search-song')
const SearchArtist = () => import('views/search/childComps/search-artist')
const SearchPlaylist = () => import('views/search/childComps/search-playlist')
const SearchAlbum = () => import('views/search/childComps/search-ablum')
const SearchMv = () => import('views/search/childComps/search-mv')

// mv
const PlayMV = () => import('views/mv/PlayMV')
const AllMV = () => import('views/mv/AllMV')
// 电台
const radio = () => import('views/radio/AllRadio')
const radioInfo = () => import('views/radio/childComps/RadioInfo')
// 新专辑
const Album = () => import('views/musicListDetail/Album')
const AlbumItem = () => import('views/musicListDetail/childComps/AlbumItem')
// 我的主页
const MyHome = () => import('views/user/MyHome')
const Delete = () => import('views/user/childComps/Delete')
Vue.use(VueRouter)

const routes = [
  {
    path: '',
    redirect: '/discover'
  },
  {
    path: '/discover',
    component: DiscoverMusic,
    children: [
      {
        path: '/',
        redirect: '/discover/individ'
      },
      {
        path: '/discover/individ',
        component: Individuation
      },
      {
        path: '/discover/category',
        component: MusicListCategory
      },
      {
        path: '/discover/ranklist',
        component: MusicRankList
      },
      {
        path: '/discover/artist',
        component: ArtistCategory
      },
      {
        path: '/discover/newsongs',
        component: NewSongsR
      },
      {
        path: '/discover/mv',
        component: MV
      }
    ]
  },
  {
    path: '/musiclistdetail/:id/:time',
    name: 'detail',
    component: MusicListDetail
  },
  {
    path: '/daymusic',
    component: DayMusicListDetail
  },
  {
    path: '/artist/:id',
    component: ArtistDetail,
    children: [
      {
        path: '/',
        redirect: '/artist/album/:id'
      },
      {
        path: '/artist/album/:id',
        component: ArtistAlbum
      },
      {
        path: '/artist/mv/:id',
        component: ArtistMV
      },
      {
        path: '/artist/desc/:id',
        component: ArtistDescDetail
      },
      {
        path: '/artist/simi/:id',
        component: SimiArtist
      }
    ]
  },
  {
    path: '/search/:key',
    component: SearchList,
    children: [
      {
        path: '/',
        redirect: '/search/songs/:key'
      },
      {
        path: '/search/songs/:key',
        component: SearchSongs
      },
      {
        path: '/search/artist/:key',
        component: SearchArtist
      }, {
        path: '/search/album/:key',
        component: SearchAlbum
      },
      {
        path: '/search/mv/:key',
        component: SearchMv
      },
      {
        path: '/search/playlist/:key',
        component: SearchPlaylist
      }
    ]

  },
  {
    path: '/playmv/:id',
    component: PlayMV
  },
  {
    path: '/allmv',
    component: AllMV
  },
  {
    // 专辑
    path: '/album',
    component: Album
  },
  {
    path: '/album/:id',
    component: AlbumItem
  },
  {
    path: '/recomradio',
    component: radio
  },
  {
    path: '/program/:id',
    component: radioInfo
  },
  {
    path: '/myhome',
    component: MyHome
  },
  {
    path: '/del',
    component: Delete
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})
export default router
